/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package py.com.peluq.model.entity;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Diego_M
 */
@Entity
@Table(name = "cobro", catalog = "peludb", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Cobro.findAll", query = "SELECT c FROM Cobro c"),
    @NamedQuery(name = "Cobro.findByCobCod", query = "SELECT c FROM Cobro c WHERE c.cobCod = :cobCod"),
    @NamedQuery(name = "Cobro.findByCobFecha", query = "SELECT c FROM Cobro c WHERE c.cobFecha = :cobFecha"),
    @NamedQuery(name = "Cobro.findByCobMonto", query = "SELECT c FROM Cobro c WHERE c.cobMonto = :cobMonto"),
    @NamedQuery(name = "Cobro.findByEstado", query = "SELECT c FROM Cobro c WHERE c.estado = :estado")})
public class Cobro implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "cob_cod", nullable = false)
    private Integer cobCod;
    @Column(name = "cob_fecha")
    @Temporal(TemporalType.DATE)
    private Date cobFecha;
    @Column(name = "cob_monto")
    private Integer cobMonto;
    @Column(name = "estado")
    private Integer estado;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cobro")
    private Collection<CobDetalle> cobDetalleCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cobro")
    private Collection<CobCheque> cobChequeCollection;
    @JoinColumn(name = "fcob_cod", referencedColumnName = "fcob_cod")
    @ManyToOne
    private FormaCobro fcobCod;
    @JoinColumn(name = "ap_nro", referencedColumnName = "ap_nro", nullable = false)
    @ManyToOne(optional = false)
    private AperCierre apNro;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cobro")
    private Collection<DetTarjetas> detTarjetasCollection;

    public Cobro() {
    }

    public Cobro(Integer cobCod) {
        this.cobCod = cobCod;
    }

    public Integer getCobCod() {
        return cobCod;
    }

    public void setCobCod(Integer cobCod) {
        this.cobCod = cobCod;
    }

    public Date getCobFecha() {
        return cobFecha;
    }

    public void setCobFecha(Date cobFecha) {
        this.cobFecha = cobFecha;
    }

    public Integer getCobMonto() {
        return cobMonto;
    }

    public void setCobMonto(Integer cobMonto) {
        this.cobMonto = cobMonto;
    }

    public Integer getEstado() {
        return estado;
    }

    public void setEstado(Integer estado) {
        this.estado = estado;
    }

    @XmlTransient
    public Collection<CobDetalle> getCobDetalleCollection() {
        return cobDetalleCollection;
    }

    public void setCobDetalleCollection(Collection<CobDetalle> cobDetalleCollection) {
        this.cobDetalleCollection = cobDetalleCollection;
    }

    @XmlTransient
    public Collection<CobCheque> getCobChequeCollection() {
        return cobChequeCollection;
    }

    public void setCobChequeCollection(Collection<CobCheque> cobChequeCollection) {
        this.cobChequeCollection = cobChequeCollection;
    }

    public FormaCobro getFcobCod() {
        return fcobCod;
    }

    public void setFcobCod(FormaCobro fcobCod) {
        this.fcobCod = fcobCod;
    }

    public AperCierre getApNro() {
        return apNro;
    }

    public void setApNro(AperCierre apNro) {
        this.apNro = apNro;
    }

    @XmlTransient
    public Collection<DetTarjetas> getDetTarjetasCollection() {
        return detTarjetasCollection;
    }

    public void setDetTarjetasCollection(Collection<DetTarjetas> detTarjetasCollection) {
        this.detTarjetasCollection = detTarjetasCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cobCod != null ? cobCod.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Cobro)) {
            return false;
        }
        Cobro other = (Cobro) object;
        if ((this.cobCod == null && other.cobCod != null) || (this.cobCod != null && !this.cobCod.equals(other.cobCod))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.com.peluq.model.entity.Cobro[ cobCod=" + cobCod + " ]";
    }
    
}
